package cc.taofoo.JUC;

import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.google.common.util.concurrent.RateLimiter;

public class GuavaAcquire {

    public static class Task extends Thread{
        static int i=0;
        @Override
        public void run() {
            System.out.println(""+(i++) +" "+ DateTime.now());
        }
    }

    public static void main(String[] args) {
        RateLimiter limiter = RateLimiter.create(5);

        for (int i = 0;i<200;i++){
            limiter.acquire();
                new Task().start();
        }
    }


}
